package annotation.singleton;

import java.util.Date;

public class SingletonTestJ {

	// constructor
	private SingletonTestJ() {
		System.out.println("init");
		this.initialDate = new Date();
	}

	// singleton instance
	private static  SingletonTestJ instance = null;

	// member field
	private Date initialDate = null;

	public static  SingletonTestJ getInstance() {
		if (instance == null) {
			synchronized (SingletonTestJ.class) {
				if (instance == null) {
					instance = new SingletonTestJ();
				}
			}
		}
		return instance;
	}

	// member method
	public String getInitialDate() { return "Initialize Date: " + this.initialDate; }
}
